﻿using System;

namespace OpenWaves.Pagination.Showcase
{
    public partial class PaginatedPage : System.Web.UI.Page
    {
        protected PaginationViewModel<NewsArticle> Pagination;
        protected IPaginationUrlFactory PaginationUrlFactory;        

        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            var paginationController = new PaginationController(Request)
                {
                    ItemsPerPage = 5,
                    MaxNumberOfPagesToShow = 5
                };

            this.Pagination = paginationController.Paginate(NewsArticlesDataSource.AllArticles);

            this.PaginationUrlFactory = new PaginationUrlFactory(this.Request);

            this.DataBind();
        }        
    }
}